package com.durian.base.rxhttp.exception

import okhttp3.Response
import java.io.IOException

/**
 * 说明：HttpResponseException
 * <p/>
 * 作者：Fanly
 * <p/>
 * 类型：Class
 * <p/>
 * 时间：2020/04/25 20:51
 * <p/>
 * 版本：version 1.0
 */
class RxHttpResponseException(
        var code: String = "",
        val response: Response? = null,
        override var message: String? = ""
) : IOException() {

    /**
     * 响应的数据
     */
    var responseResult = ""

    init {
        if (code.isNullOrEmpty()) {
            code = response?.code.toString()
        }
        if (message?.isNotEmpty() != true) {
            message = response?.message
        }
    }
}